Skip to content

Conversation

@rragundez
Copy link
Contributor

@rragundez rragundez commented Nov 21, 2025

This is a WIP because there are some bugs in the underlying fastapi-sso library and there is still missing code in this PR to address robustness, since oauth has to be quite air tight there are a log of exceptions to consider.
For the moment this draft PR adds the patterns to create an oauth provider to the application.

Google, GitHub oauth should be working as is, I tested it.

@rragundez
Copy link
Contributor Author

@igorbenav please have a look, I think the pattern looks OK, but perhaps is trusting fastapi-sso too much?? l do like the use of the OpenID object though, but for example there is a bug in the microsoft provider that will require a PR in fastapi-sso (I will do that soon).

@igorbenav igorbenav changed the base branch from main to staging November 21, 2025 18:49
@rragundez rragundez marked this pull request as ready for review November 25, 2025 12:03
"""
if not oauth_user.email:
raise UnauthorizedException(f"Invalid response from {self.provider_name.title()} OAuth.")
username = oauth_user.email.split("@")[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there any sort of collision handling here?

router.include_router(tasks_router)
router.include_router(tiers_router)
router.include_router(rate_limits_router)
router.include_router(users_router)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for this order change?

}


class GithubSSOProvider(BaseOAuthProvider):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is github the only one named with "SSO" instead of OAuth?

)
return access_token

async def _login_handler(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing return type

Copy link
Collaborator

@igorbenav igorbenav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few things that need addressing or answering, plus remove inline comments please (you can use docstrings to document decisions if necessary).

Good PR overall, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants